﻿/*
 * Erstellt mit SharpDevelop.
 * Benutzer: Kai Patrick
 * Datum: 01.04.2008
 * Zeit: 13:40
 * 
 * Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
 */

using System;
using Microsoft.Scripting;
using MSAst = Microsoft.Scripting.Ast;

namespace Gamadus.Engine.Compiler.Ast
{
	/// <summary>
	/// Description of ExpressionStatement.
	/// </summary>
	public class ExpressionStatement : Statement
	{
        private readonly Expression m_expression;

        public ExpressionStatement(Irony.Compiler.AstNode node) : base(node)
        {
        	switch(node.Term.Name)
        	{
        		case "FunctionExpression":
        			m_expression = new Function(node);
        			break;
        		default:
        			throw new ArgumentException("Invalid expression statement: "+node.Term.Name);
        	}
            //m_expression = expression;
        }

        protected internal override MSAst.Expression Generate()
        {
			return MSAst.Ast.Statement(
				Span,
				m_expression.Generate()
			);
			throw new NotImplementedException();
        }
        
		public override string ToString()
		{
			return m_expression.ToString();
		}
	}
}
